package org.myontology.controller.rules.impl;

import model.Vocabulary;

import org.myontology.controller.AttributeHolder;
import org.myontology.controller.SesameSession;
import org.myontology.controller.impl.ShowAction;
import org.myontology.controller.rules.Rule;
import org.openrdf.model.URI;
import org.openrdf.model.impl.URIImpl;

public class IsStandardOntology implements Rule {

	public boolean check(AttributeHolder attributes,SesameSession session) {
		try {
			URI uri = ShowAction.URI.getValue(attributes);
			String val =session.loadSingleObject(uri, Vocabulary.BELONGSTOONTOLOGYMODULE);
			URI om ;
			if (val==null)
				om= uri;
			else
				om= new URIImpl(val);
			if (session.hasTriple(om, Vocabulary.ISLOCKED, om)) {
				return false;
			}
		} catch (Exception e) {
			
		}
		
		return true;
	}

}
